var login = {
    check: function () {
        var username = $('input[name="username"]').val();
        var password = $('input[name="password"]').val();
        var code = $('input[name="code"]').val();
        if (!username) {
            dialog.error("用户名不能为空");
            return;
        }
        if (!password) {
            dialog.error("密码不能为空");
            return;
        }
        if (!code) {
            dialog.error("验证码不能为空");
            return;
        }
        var url = "/index.php/admin/login/check";
        var data = {'username': username, 'password': password, 'code': code};
        $.post(url, data, function (result) {
            if (result.status == 0) {
                dialog.error(result.message);
            }
            if (result.status == 1) {
                console.log(result.message);
                dialog.succeed(result.message, '/index.php/Admin/Index/index');
            }
        }, 'JSON');
    }

}
